<!doctype html>
<html>
	<head>
		<title>羽乐汇</title>
		<meta name="keywords" content="羽毛球，球会，球场，教练">
		<meta name="charset" content="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/index.css">
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/jquery.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/bootstrap.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/md5.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/jquery-form.js"></script>
	<body>
	<!--  -->
		<div class="visible-lg visible-md pc_index">
		<div class="top">
			<div class="ttop">
				<span>欢迎来到羽乐汇</span>
				<div>
					<span class="wellcome"></span>
					<span class="login">
						<button class="login_btn">登陆</button>
						<!-- <button class="notlogin_btn">注销</button> -->
						<a href="<{:U('Index/registration')}>">注册</a>
						
					</span>
					<!-- <button class="sign_btn">注册</button> -->
					<a class="login_after" href="<{:U('User/index')}>">个人主页</a>
					<a href="__PUBLIC__/HTML/vip_center.html">vip中心</a>
				</div>
			</div>
			<div>
				<img src="__PUBLIC__/PICTURE/HomePage/logo.jpg">
			</div>
			<div class="main_nav">
				<ul>
					<li><a href="<{:U('Index/index')}>">首页</a></li>
					<li><a href="<{:U('Gymnasium/index')}>">球场</a></li>
					<li><a href="<{:U('Club/index')}>">球会</a></li>
					<li>培训</li>
					<li><a href="<{:U('Activity/activity')}>">活动</a></li>
					<li><a href="<{:U('Coach/index')}>">教练</a></li>
					<li>竞赛</li>
					<li><a href="<{:U('Announce/index')}>">公告</a></li>
				</ul>
			</div>
		</div>
			<div class="search_content">
				<div class="top_search">
					<form action="<{:U('Announce/testAjaxReturn')}>" id="form1" name="search_form" method="post" >
						<select name="search_type" class="ui-select search_type f_l">
							<option value="1" {if $search_type eq 1}selected="selected"{/if}>搜公告</option>
						</select>
						<input type="text" name="search_keyword" autocomplete="off"class="" holder="请输入您要搜索的关键词" value="" />
						<button class="" rel="search_btn" >搜索</button>
					</form>
				</div>
			</div>
			<div class="notice_content">
				<div class="notice_nav">
					<ul>
						<li class="li_first">最新公告</li>
						<li>与我相关</li>
						<li>收藏</li>
					</ul>
				</div>
				<div class="notice_nav_content">
					<!-- <div></div> -->
				</div>
			</div>
			<div class="foot">
				
				<div>
					<p>联系我们</p>
					<p>关于我们</p>
					<p>加入我们</p>
				</div>
				<div>
					<p>电话：400-800-8888 周一至周六9：00-18：00</p>
					<p>[羽乐汇]<a href="http://oto.my3w.com">http://oto.my3w.com</a></p>
				</div>
			</div>
		</div>
		<div class="visible-xs visible-sm wap_index">
			<div class="container-fluid notice_content" id="wap_index">
				<header class="row notice_nav">
					<ul>
						<li ><a href="<{:U('Index/index')}>"><img src="__PUBLIC__/PICTURE/HomePage/pre.png"/></a></li>
						<li class="li_first">最新公告</li>
						<li>与我相关</li>
						<li>收藏</li>
					</ul>
				</header>
				<div class="notice_nav_content">
					<div class="search_content">
						<div class="top_search">
							<form action="" id="form1" name="search_form" >
								<select name="search_type" class="ui-select search_type f_l" id="searchlist">
									<option value="0">搜系统公告</option>
									<option value="1">搜球馆公告</option>
									<option value="2">搜教练公告</option>
									<option value="3">搜球会公告</option>
									<option value="-1">搜所有公告</option>
								</select>
								<input type="text" name="search_keyword" class="" id="searchword" holder="请输入您要搜索的关键词" value="" />
								<button class="" rel="search_btn" id="searchbutton" type="button">搜索</button>
							</form>
						</div>
					</div>
					<{:W('Announce/new_notice')}>
					<div class="content_foot">
						<ul>
							<li><button class="pageup"  type="button" disabled="disabled">上一页</button></li>
							<li><button class="pagedown" type="button" disabled="disabled">下一页</button></li>
						</ul>
					</div>
				</div>
			</div>
			<div class="foot row">
				<div>
					<p>联系我们</p>
					<p>关于我们</p>
					<p>加入我们</p>
				</div>
				<div>
					<p>电话：400-800-8888 周一至周六9：00-18：00</p>
					<p>[羽乐汇]<a href="http://oto.my3w.com">http://oto.my3w.com</a></p>
				</div>
			</div>
		</div>
		<script type="text/javascript">
		var announcecount=<{$announce_count}>; //公告总数
		var page_num=1;  //当前页数
		var totalPage;
		var announce_count;  //后台返回公告条数
		var announceJson;  //公告内容Json数组
		var pagetype=0;  //翻页类型

		<!------------------打开页面异步加载公告------------------>

		$(function(){
			$.post('__URL__/AnnounceTimeOrderPublish',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300); 
		});
		function setpage(){
			totalPage=Math.ceil(announce_count/5);
			if(page_num>1){
				$(".pageup").attr('disabled',false);
			}
			else{
				$(".pageup").attr('disabled',true);
			}
			if(totalPage>page_num){
				$(".pagedown").attr('disabled',false);
			}
			else{
				$(".pagedown").attr('disabled',true);
			}
			if(page_num<totalPage){
				for (var i = 0; i <= 4; i++) {
					var li_title=".li_title"+i;
					var li_content=".li_content"+i;
					var li_time=".li_time"+i;
					var img="#img"+i;
					var total="#total"+i;
					var announce_picture=announceJson[i].announce_picture;
					$(total).css('display','block');
					$(img).html('<img src="'+announce_picture+'">');
					$(li_title).html('<span>公告标题:</span>'+announceJson[i].announce_title);
					$(li_content).html('<span>公告内容:</span>'+announceJson[i].announce_content);
					$(li_time).html('<span>发布时间:</span>'+announceJson[i].announce_time);
				}
			}
			else{
				for (var i = 0; i <= announce_count-(page_num-1)*5-1; i++) {
					var li_title=".li_title"+i;
					var li_content=".li_content"+i;
					var li_time=".li_time"+i;
					var img="#img"+i;
					var total="#total"+i;
					var announce_picture=announceJson[i].announce_picture;
					$(total).css('display','block');
					$(img).html('<img src="'+announce_picture+'">');
					$(li_title).html('<span>公告标题:</span>'+announceJson[i].announce_title);
					$(li_content).html('<span>公告内容:</span>'+announceJson[i].announce_content);
					$(li_time).html('<span>发布时间:</span>'+announceJson[i].announce_time);
				}
				for(var i = announce_count-(page_num-1)*5; i <= 4; i++){
					var li_title=".li_title"+i;
					var li_content=".li_content"+i;
					var li_time=".li_time"+i;
					var img="#img"+i;
					var total="#total"+i;
					$(total).css('display','none');
					$(img).html("");
					$(li_title).html("");
					$(li_content).html("");
					$(li_time).html("");
				}
			}
		}
		//上一页
		$('.pageup').bind('click',function(){
			if(pagetype==0){
			page_num--;
			$.post('__URL__/AnnounceTimeOrderPublish',{'page_num':page_num},function(resultList){
				totalPage=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300); 
		}
			else{
				page_num--;
				var search_type=$("#searchlist").val();
  			var search_info=$("#searchword").val();
				$.post('__URL__/announceSearch',{'search_type':search_type,'search_info':search_info,'search_page_num':page_num},function(resultList){
				totalPage=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300); 
			}
		});
		//下一页
		$('.pagedown').bind('click',function(){
			if(pagetype==0){
			page_num++;
			$.post('__URL__/AnnounceTimeOrderPublish',{'page_num':page_num},function(resultList){
				totalPage=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300); 
		}
			else{
				page_num++;
				var search_type=$("#searchlist").val();
  			var search_info=$("#searchword").val();
				$.post('__URL__/announceSearch',{'search_type':search_type,'search_info':search_info,'search_page_num':page_num},function(resultList){
				totalPage=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300);
			}
		});
		<!------------------搜索------------------>
		$("#searchbutton").bind("click",function(){
  			var search_type=$("#searchlist").val();
  			var search_info=$("#searchword").val();
  			page_num=1;
  			pagetype=1;
  			$.post('__URL__/announceSearch',{'search_type':search_type,'search_info':search_info,'search_page_num':page_num},function(resultList){
				totalPage=resultList.page_num;
				announce_count=resultList.announce_count;
				announceJson=resultList.result;
    	},'json');
			setTimeout("setpage()",300); 
		});

		</script>
	</body>
</html>